package cn.xiuxian.util;

public class ColumnUtil {

    public  static  String  snake_Method(String column){

        String  newcol = "";
        char[] chars = column.toCharArray();
        int j = 0;
        int [] arr = new int[column.length()];
        for (int i = 0; i < chars.length; i++) {
            if("_".equals(String.valueOf(chars[i]))){
                arr[j] = i-j;
                j=j+1;
            }
        }
        char[] chars1 = new char[column.length()-j];
        int [] array = new int[j];
        for (int i = 0; i < array.length; i++) {
            array[i]=arr[i];
        }
        int k = 0;
        for (int i = 0; i < chars.length; i++) {
            if ("_".equals(String.valueOf(chars[i]))){

            }else{
                chars1[k]=chars[i];
                k++;
            }
        }
        for (int n = 0; n < array.length; n++) {
            for (int m = 0; m < chars1.length; m++) {
                if(array[n]==m){
                    char c = Character.toUpperCase(chars1[m]);
                    chars1[m]=c;
                }
            }
        }

        for (int i = 0; i < chars1.length; i++) {
            newcol = newcol + chars1[i];
        }
      return  newcol;
    }

    public static void main(String[] args) {
        String sql = "jdbc_user_pass_power_date";
        System.out.println(snake_Method(sql));
    }
}
